Skip to content

More perf improvements#638

Merged
dcherian merged 7 commits into
mainfrom
perf-getitem-hot-path
May 12, 2026
Merged

More perf improvements#638
dcherian merged 7 commits into
mainfrom
perf-getitem-hot-path

Conversation

@dcherian
Copy link
Copy Markdown
Contributor

@dcherian dcherian commented May 2, 2026

No description provided.

dcherian and others added 4 commits May 1, 2026 20:25
The string is typically shared across all variables in a dataset, so
parse once per distinct attr. Wrap the cached result in `Frozen` to
prevent accidental mutation of the shared value.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Skip the per-key _get_all fan-out when every key is already a plain
data-variable name — the slow path would just fall through to the same
result. Decoration via get_associated_variable_names is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
drop_bounds is a no-op unless the caller passed a scalar key, so
list-key calls (ds.cf[[name]]) never need it. Inline the lookup so
list-key paths skip the full-dataset bounds scan entirely.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dcherian dcherian force-pushed the perf-getitem-hot-path branch from 76a9b84 to 8457375 Compare May 12, 2026 20:45
Comment thread cf_xarray/accessor.py
varnames = list(key_iter)
coords = []
successful = dict.fromkeys(key_iter, True)
else:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simply indented

@dcherian dcherian force-pushed the perf-getitem-hot-path branch from 234a065 to e5291c0 Compare May 12, 2026 20:47
@dcherian dcherian enabled auto-merge (rebase) May 12, 2026 20:50
@dcherian dcherian disabled auto-merge May 12, 2026 20:52
@dcherian dcherian merged commit 192f107 into main May 12, 2026
10 checks passed
@dcherian dcherian deleted the perf-getitem-hot-path branch May 12, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant